﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using Microsoft.EntityFrameworkCore;

namespace LiveHub.Share.DataModels;

public class GroupModel : DataModel
{
    [Key]
    [Column(TypeName = "varchar(64)")]
    public string GroupId { get; set; } = "";
    
    [Column(TypeName = "varchar(50)")]
    public string Name { get; set; } = "";
    public List<UserModel> Users { get; init; } = [];
    public List<MessageModel> Messages { get; init; } = [];
}

public class MessageModel : DataModel
{
    [Key]
    [Column(TypeName = "varchar(64)")]
    public string MessageId { get; set; } = "";
    
    [Column(TypeName = "varchar(10)")]
    public string UserId { get; set; } = "";

    public UserModel User { get; set; } = new();
    
    [Column(TypeName = "varchar(512)")]
    public string Body { get; set; } = "";
    
    [Column(TypeName = "varchar(32)")]
    public string Time { get; init; } = "";
}